package com.example.mobile2032021606170hsy0427;

import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private EditText edtTxtMainCarage;
    private Button btnMainCarage;
    private RecyclerView rvMainCarage;
    private List<Carage> list = new ArrayList<>();
//    private  int[ ] carageIds={R.drawable.carage1,R.drawable.carage2,R.drawable.carage3,R.drawable.carage4,R.drawable.carage5};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        initData();
        rvMainCarage.setLayoutManager(new LinearLayoutManager(this));
        rvMainCarage.setAdapter(new CarageRVAdapter(list));
    }
    private  void initData(){
        list.add(new Carage(R.drawable.carage1,"广珠城轨顺德站-停车场","空位：40","价格：5元/小时","距离：70公里,","地址：碧桂公路与碧桂路交叉口","更多信息"));
        list.add(new Carage(R.drawable.carage2,"清晖园-停车场","空位：30","价格：4元/小时","距离：64公里 ","地址：盖里直1街与宝华巷交叉口北50米","更多信息"));
        list.add(new Carage(R.drawable.carage3,"大良美食城-停车场","空位：20","价格：7元/小时","距离：66公里"," 地址：顺德区顺德美食娱乐城(祥兴南路)","更多信息"));
        list.add(new Carage(R.drawable.carage4,"华桂园-停车场","空位：10","价格：5元/小时","距离：73公里","地址：迎宾路西150米","更多信息"));
        list.add(new Carage(R.drawable.carage5,"碧琴湾-地下停车场","空位：15","价格：10元/小时","距离：53公里"," 地址：佛山市南海区南港路12号","更多信息"));
    }
    private void initView() {
        edtTxtMainCarage = findViewById(R.id.edtTxt_main_carage);
        btnMainCarage = findViewById(R.id.btn_main_carage);
        rvMainCarage = findViewById(R.id.rv_main_carage);
    }
}
